﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using tools_library;

namespace rclient
{
    public partial class frmConnect : Form
    {
        private Node Rnode=null; //the node to return

        public frmConnect()
        {
            InitializeComponent();
        }

        public new Node ShowDialog()
        {
            base.ShowDialog();
            return Rnode;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnConnect_Click(object sender, EventArgs e)
        {
            HelperTool helper = new HelperTool();
            IPAddress address = helper.GetAddressFromHost(txtRemoteHost.Text);
            int port = 0;
            int.TryParse(txtRemotePort.Text, out port);
            IPEndPoint ep = new IPEndPoint(address, port);
            Rnode = new Node(ep);
        }

        private void frmConnect_Load(object sender, EventArgs e)
        {

        }
    }
}
